import request from '../../utils/request';
const user = {
  state: {

  },

  getters: {

  },

  mutations: {

  },

  actions: {
    /**
     * 获取问题列表
     * @payload{
     *  pageNum  string 
     *  mobileNo string 
     *  province string 
     *  city     string 
     *  startDay string 
     *  endDay   string 
     * }
     * */ 
    GET_ISSUE_LIST({}, payload) {
      return new Promise((resolve, reject) => {
        request.post('/question/list.htm', payload).then(res => {
          resolve(res);
        }).catch(err => {
          console.error('err::::', err);  
          reject(err);
        })
      });
    },

    /**
     * 问题管理-新增/修改/删除
     * @param payload{
     *  id string
     *  title string 
     *  caseType string 
     *  content  string 
     *  state string  状态 normal("正常"), deleted("已删除"), done("已处理");
     *  answer string 
     *  province string 
     *  city
     * }
     * */ 
    UPDATE_ISSUE({}, payload) {
      return new Promise((resolve, reject) => {
        request.post('/question/save.htm', payload).then(res => {
          resolve(res);
        }).catch(err => {
          console.error('err::::', err);  
          reject(err);
        })
      });
    }

  }
}

export default user